'''列表切片'''
# l = list(range(10))
# print(l)
# print(l[0:7])#star:end,前包括后不包括
# print(l[0:8:2])

'''切片赋值'''
l =[1,2,3]
# 将后面的元素填充到切出来的位置 ['hello', 3]
l[0:2] = ['hello']
print(l)

l = [1,2,3]
# ['h', 'e', 'l', 'l', 'o', 3]
l[0:2] = 'hello'
print(l)


l = [1,2,3,4,5,6]
# [1, 2, 3, 'hello', 6]
l[-3:-1] = ["hello"]
print(l)

l = [3,4,6]#变成1，2，3，4，5，6，7，8，9

l[0:0] = [1,2]
l[4:4] = [5]
l[5+1:] = [7,8,9]
print(l)

l = list(range(1,10))
l[0:10:2] = 'hello'
# ['h', 2, 'e', 4, 'l', 6, 'l', 8, 'o']
# 当步长值>=2时，切出来的若干个元素，
# 赋值的可迭代元素个数要与且出来的元素保持一致
print(l)